﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using LP580.CG;
public partial class User_UC2Support : System.Web.UI.Page
{
    protected clsCompanySupport cls;
    private clsUserAccount ua = clsUserAccount.getCookieUser(true);
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Request.QueryString["act"] == "t")
            {
                cls = new clsCompanySupport(ua.UserID);
                cls.GalleryQQ = Utils.RF_str("GalleryQQ");
                cls.DutyQQ = Utils.RF_str("DutyQQ");
                cls.Complaint = Utils.RF_str("Complaint");
                cls.UserID = ua.UserID;
                if (string.IsNullOrEmpty(cls.GalleryQQ) || string.IsNullOrEmpty(cls.DutyQQ) || string.IsNullOrEmpty(cls.Complaint))
                {
                    Utils.WrAlertGoBack("所有客服都需填写！");
                    return;
                }
                if(clsCompanySupport.HasUser(ua.UserID))
                {
                    clsCompanySupport.Update(cls);
                }
                else
                {
                    clsCompanySupport.Insert(cls);
                }
                Utils.WrAlertGoBack("提交成功！");
            }
            else
            {
                if (clsCompanySupport.HasUser(ua.UserID))
                {
                    cls = new clsCompanySupport(ua.UserID);
                }
                else
                {
                    cls = new clsCompanySupport();
                }
            }
        }
    }
}